#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2019/5/22 5:00 PM
# @Author  : Hardy
# @File    : get_poi_test.py


import requests
import json
import pandas as pd
import sys
import time
time.sleep(0.001)

KEY = '3bce136bd311f4cc6572730a1581fe95'

URL = 'https://restapi.amap.com/v3/geocode/regeo?output=json&location=%s&key=3bce136bd311f4cc6572730a1581fe95&radius=50&extensions=all'

GCJ_URL = 'https://restapi.amap.com/v3/assistant/coordinate/convert?locations=%s&coordsys=baidu&output=json&key=3bce136bd311f4cc6572730a1581fe95'

if __name__ == '__main__':
    # location = '121.67335916298835,31.198086932546932'
    location = '120.12825955053539,30.28950248023442'

    gcj_loc = requests.get(GCJ_URL % (location,)).json()
    print(gcj_loc)
    gcj_loc = gcj_loc.get('locations')

    out = requests.get(URL % (gcj_loc,)).json()
    print(out)






